*------------------------------------------------------------------------------
* Dollars, Desks, and Development: The Impact of Local Sales Tax Revenue Redistribution on Recipient Programs in North Carolina

* Authors: Alex Combs and Whitney Afonso

* Generate Table 2, Fig. 2, and event study plots for Fig. 3-5
*------------------------------------------------------------------------------

use analysis_data, clear

*------------------------------------------------------------------------------
* Table 2: Summary stats
*------------------------------------------------------------------------------
tabstat r_pc_ART44524 r_pc_net_lst_redist if year>=2017 & dcdh_sample==1, ///
 by(receive_treat) stat(mean min max) save

matrix 	norev = r(Stat1)'
matrix 	rev = r(Stat2)'

putexcel set sumstatsbyreceipt.xlsx, replace
putexcel A2 = matrix(norev), names nformat(number_sep_d2)
putexcel E2 = matrix(rev), colnames nformat(number_sep_d2)

gen taxrate_00 = taxrate * 100
gen pop_000 = pop/1000

tabstat r_pc_rev_394042  r_pc_own_source ///
 r_pc_rev_prop_tax taxrate_00 r_pc_rev_less_lstprop ///
 r_pc_exp_earmark r_pc_exp_nonearmark r_pc_exp_k12 r_pc_exp_commcoll ///
 r_pc_exp_econdev pop_000 if dcdh_sample==1, /// 
 by(receive_treat) stat(mean min max) save

matrix 	norev = r(Stat1)'
matrix 	rev = r(Stat2)'

putexcel set sumstatsbyreceipt.xlsx, modify
putexcel A5 = matrix(norev), rownames nformat(number_sep)
putexcel E5 = matrix(rev), nformat(number_sep)

*------------------------------------------------------------------------------
* Figure 2
*------------------------------------------------------------------------------
preserve
collapse (mean) r_pc_rev_394042, by(receive_group year)
twoway 	(line r_pc_rev_394042 year if receive_group==0, lcolor(navy*1) lwidth(medthick)) ///
		(line r_pc_rev_394042 year if receive_group==1, lcolor(navy*0.5) lwidth(medthick)) ///
		(line r_pc_rev_394042 year if receive_group==2, lcolor(cranberry*0.3) lwidth(medthick)) ///
		(line r_pc_rev_394042 year if receive_group==3, lcolor(cranberry*0.6) lwidth(medthick)) ///
		(line r_pc_rev_394042 year if receive_group==4, lcolor(cranberry*1) lwidth(medthick)), ///
		ytitle("Local Sales Tax Revenue Per Cap") ///
		legend(order(1 "0" 2 "(0.1,6.5]" 3 "(6.5,20]" 4 "(20,30]" 5 "(30,60]") ///
		cols(1) subtitle("Revenue Groups")) /// 
		xline(2016,lcolor(black) lpattern(dash)) ///
		xlabel(2013(1)2019) ///
		ylabel(0(50)350)
graph export trends_received.png, replace
restore

*------------------------------------------------------------------------------
* Event study plots for Fig. 3 and 4
*------------------------------------------------------------------------------
use cte_lstrev.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log LST Rev. per Capita")
graph export cte_lstrev.png, replace

use cte_nonproprev.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Non-Property Rev. per Capita")
graph export cte_nonproprev.png, replace

use cte_proprev.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Property Tax Rev. per Capita")
graph export cte_proprev.png, replace

use cte_proptaxrate.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Property Tax Rate per $1,000 Value")
graph export cte_proptaxrate.png, replace

use cte_earmarks.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Earmarked Exp. per Capita")
graph export cte_earmarks.png, replace

use cte_earmarks.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Earmarked Exp. per Capita")
graph export cte_earmarks.png, replace

use cte_nonearmark.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Non-Earmarked Exp. per Capita")
graph export cte_nonearmark.png, replace

use cte_k12opcap.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log K-12 Exp. per Capita")
graph export cte_k12opcap.png, replace

use cte_commcoll.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Community College Exp. per Capita")
graph export cte_commcoll.png, replace

use cte_econdev.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log Econ. Dev. Exp. per Capita")
graph export cte_econdev.png, replace

use cte_k12op.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log K-12 Operating Exp. per Capita")
graph export cte_k12op.png, replace

use cte_k12cap.dta, clear
gen year = _n
replace year = 2012+year
twoway (rarea lb_CI_95 up_CI_95 year, color(gs14%70)) ///
	(connected point_estimate year, lp(solid) lc(black) mlcolor(black) mfcolor(white) msize(1.5)), ///
	legend(off) xmtick(2013(1)2019) xlabel(2013(1)2019) scale(1.2) yline(0, lpatter(dash)) ///
	xtitle("") ytitle("Log K-12 Capital Exp. per Capita")
graph export cte_k12cap.png, replace

*------------------------------------------------------------------------------
* Event study plots for Fig. 5
*------------------------------------------------------------------------------

use analysis_data, clear

qui xtreg log_r_pc_exp_nonearmark ib2016.year##i.treat_group log_pop /// 
 log_r_pc_all_oth_rev if dcdh_sample==1, fe robust
est store m_nonearmark

qui xtreg log_r_pc_k12opcap ib2016.year##i.treat_group log_pop /// 
 log_r_pc_all_oth_rev expobj_school_allother if dcdh_sample==1, fe robust
est store m_k12

coefplot m_nonearmark, omit base vertical ///
			 keep(*.year#3.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log Non-Earmarked Exp. per Capita") ///
			 ylabel(-0.15(0.05)0.15) ///
			 xline(4) ///
			 title("Net Gain Tercile = 3")
			 graph export m_nonearmark3.png, replace
			 
coefplot m_nonearmark, omit base vertical ///
			 keep(*.year#2.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log Non-Earmarked Exp. per Capita") ///
			 ylabel(-0.15(0.05)0.15) ///
			 xline(4) ///
			 title("Net Gain Tercile = 2")
			 graph export m_nonearmark2.png, replace
			 
coefplot m_nonearmark, omit base vertical ///
			 keep(*.year#1.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log Non-Earmarked Exp. per Capita") ///
			 ylabel(-0.15(0.05)0.15) ///
			 xline(4) ///
			 title("Net Gain Tercile = 1")
			 graph export m_nonearmark1.png, replace

coefplot m_k12, omit base vertical ///
			 keep(*.year#3.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log K-12 Exp. per Capita") ///
			 ylabel(-0.2(0.2)0.6) ///
			 xline(4) ///
			 title("Net Gain Tercile = 3")
			 graph export m_k123.png, replace
			 
coefplot m_k12, omit base vertical ///
			 keep(*.year#2.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log K-12 Exp. per Capita") ///
			 ylabel(-0.2(0.2)0.6) ///
			 xline(4) ///
			 title("Net Gain Tercile = 2")
			 graph export m_k122.png, replace
			 
coefplot m_k12, omit base vertical ///
			 keep(*.year#1.treat_group) ///
			 yline(0) nolabels /// 
			 recast(connected) lcolor(black) ciopts(recast(rarea) color(gs14%70)) ///
			 mlcolor(black) mfcolor(white) msize(1.5) ///
			 xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019") ///
			 ytitle("Log K-12 Exp. per Capita") ///
			 ylabel(-0.2(0.2)0.6) ///
			 xline(4) ///
			 title("Net Gain Tercile = 1")
			 graph export m_k121.png, replace

*------------------------------------------------------------------------------
* Appendix A
*------------------------------------------------------------------------------

* Property tax revenue
did_multiplegt_dyn log_r_pc_rev_prop_tax cty_number year r_pc_ART44524, ///
 controls(log_pop log_r_pc_rev_control_prop) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto m_rev_prop_tax
 
xtreg log_r_pc_rev_prop_tax c.r_pc_ART44524#i.post /// 
 log_r_pc_rev_control_prop log_pop i.year if dcdh_sample==1, fe robust

* Property Tax Rate
did_multiplegt_dyn taxrate cty_number year r_pc_ART44524, ///
 controls(log_pop log_r_pc_rev_control_prop) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto m_taxrate

xtreg taxrate c.r_pc_ART44524#i.post log_r_pc_rev_control_prop /// 
 log_pop i.year if dcdh_sample==1, fe robust
 
* Non-property other revenue
did_multiplegt_dyn log_r_pc_rev_less_lstprop cty_number year r_pc_ART44524, ///
 controls(log_pop log_r_pc_rev_control_onoprop) effects(3) placebo(3) ///
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo) 
est sto m_rev_other
 
xtreg log_r_pc_rev_less_lstprop c.r_pc_ART44524#i.post /// 
 log_r_pc_rev_control_onoprop log_pop i.year if dcdh_sample==1, fe robust

esttab m_rev_prop_tax m_taxrate m_rev_other using "appendixA.rtf", replace /// 
 b(%9.4f) se(%9.4f) s(p_placebo, label("Joint Sig. Placebo")) /// 
 order(Placebo_3 Placebo_2 Placebo_1 Effect_1 Effect_2 Effect_3 Av_tot_eff) ///
 coeflabels(Effect_1 "2017" Effect_2 "2018" Effect_3 "2019" ///
 Av_tot_eff "Avg Total Effect" /// 
 Placebo_1 "2015" Placebo_2 "2014" Placebo_3 "2013") ///
 nogaps compress
 
*------------------------------------------------------------------------------
* Appendix B
*------------------------------------------------------------------------------

* LST per capita
did_multiplegt_dyn log_r_pc_rev_394042 cty_number year r_pc_ART44524, /// 
 controls(log_pop log_r_pc_rev_control_lst) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_lst 

xtreg log_r_pc_rev_394042 c.r_pc_ART44524#i.post log_r_pc_rev_control_lst /// 
 log_pop i.year if dcdh_sample==1, fe robust

* Earmarked expenditures
did_multiplegt_dyn log_r_pc_exp_earmark cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_earmarked

xtreg log_r_pc_exp_earmark c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop i.year if dcdh_sample==1, fe robust
 
* Non-earmarked
did_multiplegt_dyn log_r_pc_exp_nonearmark cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_nonearmarked

xtreg log_r_pc_exp_nonearmark c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop i.year if dcdh_sample==1, fe robust

* K-12 expenditures
did_multiplegt_dyn log_r_pc_k12opcap cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_k12
 
xtreg log_r_pc_k12opcap c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop expobj_school_allother i.year if dcdh_sample==1, fe robust

* Community college
did_multiplegt_dyn log_r_pc_exp_commcoll cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_cc
 
xtreg log_r_pc_exp_commcoll c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop i.year if dcdh_sample==1, fe robust

* Econ development
did_multiplegt_dyn log_r_pc_exp_econdev cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mb_ed 

xtreg log_r_pc_exp_econdev c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop i.year if dcdh_sample==1, fe robust 

esttab mb_lst mb_nonearmarked mb_earmarked mb_k12 mb_cc mb_ed /// 
 using "appendixB.rtf", replace /// 
 b(%9.4f) se(%9.4f) s(p_placebo, label("Joint Sig. Placebo")) /// 
 order(Placebo_3 Placebo_2 Placebo_1 Effect_1 Effect_2 Effect_3 Av_tot_eff) ///
 coeflabels(Effect_1 "2017" Effect_2 "2018" Effect_3 "2019" ///
 Av_tot_eff "Avg Total Effect" /// 
 Placebo_1 "2015" Placebo_2 "2014" Placebo_3 "2013") ///
 nogaps compress
 
*------------------------------------------------------------------------------
* Appendix C
*------------------------------------------------------------------------------

* K-12 operating
did_multiplegt_dyn log_r_pc_k12op cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mc_k12op
 
xtreg log_r_pc_k12op c.r_pc_ART44524#i.post log_r_pc_all_oth_rev log_pop /// 
 expobj_school_allother i.year if dcdh_sample==1, fe robust

* K-12 capital
did_multiplegt_dyn log_r_pc_k12cap cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mc_k12cap
 
xtreg log_r_pc_k12cap c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop expobj_school_allother i.year if dcdh_sample==1, fe robust 

esttab mc_k12op mc_k12cap  using "appendixC.rtf", replace /// 
 b(%9.4f) se(%9.4f) s(p_placebo, label("Joint Sig. Placebo")) /// 
 order(Placebo_3 Placebo_2 Placebo_1 Effect_1 Effect_2 Effect_3 Av_tot_eff) ///
 coeflabels(Effect_1 "2017" Effect_2 "2018" Effect_3 "2019" ///
 Av_tot_eff "Avg Total Effect" /// 
 Placebo_1 "2015" Placebo_2 "2014" Placebo_3 "2013") ///
 nogaps compress

*------------------------------------------------------------------------------
* Online Appendix B
*------------------------------------------------------------------------------

* LST per capita
did_multiplegt_dyn log_r_pc_rev_394042 cty_number year r_pc_ART44524, /// 
 controls(log_pop log_r_pc_rev_control_lst medinc) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_lst 

xtreg log_r_pc_rev_394042 c.r_pc_ART44524#i.post log_r_pc_rev_control_lst /// 
 log_pop medinc i.year if dcdh_sample==1, fe robust

* Earmarked expenditures
did_multiplegt_dyn log_r_pc_exp_earmark cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother medinc) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_earmarked

xtreg log_r_pc_exp_earmark c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop medinc i.year if dcdh_sample==1, fe robust
 
* Non-earmarked
did_multiplegt_dyn log_r_pc_exp_nonearmark cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop medinc) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_nonearmarked

xtreg log_r_pc_exp_nonearmark c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop medinc i.year if dcdh_sample==1, fe robust

* K-12 expenditures
did_multiplegt_dyn log_r_pc_k12opcap cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother medinc) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_k12
 
xtreg log_r_pc_k12opcap c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop expobj_school_allother medinc i.year if dcdh_sample==1, fe robust

* Community college
did_multiplegt_dyn log_r_pc_exp_commcoll cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop medinc) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_cc
 
xtreg log_r_pc_exp_commcoll c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop medinc i.year if dcdh_sample==1, fe robust

* Econ development
did_multiplegt_dyn log_r_pc_exp_econdev cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop medinc) effects(3) placebo(3) /// 
 drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_ed 

xtreg log_r_pc_exp_econdev c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop medinc i.year if dcdh_sample==1, fe robust 

esttab mob_lst mob_nonearmarked mob_earmarked mob_k12 mob_cc mob_ed /// 
 using "onlineappendixB.rtf", replace /// 
 b(%9.4f) se(%9.4f) s(p_placebo, label("Joint Sig. Placebo")) /// 
 order(Placebo_3 Placebo_2 Placebo_1 Effect_1 Effect_2 Effect_3 Av_tot_eff) ///
 coeflabels(Effect_1 "2017" Effect_2 "2018" Effect_3 "2019" ///
 Av_tot_eff "Avg Total Effect" /// 
 Placebo_1 "2015" Placebo_2 "2014" Placebo_3 "2013") ///
 nogaps compress

* K-12 operating
did_multiplegt_dyn log_r_pc_k12op cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother medinc) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_k12op
 
xtreg log_r_pc_k12op c.r_pc_ART44524#i.post log_r_pc_all_oth_rev log_pop /// 
 expobj_school_allother medinc i.year if dcdh_sample==1, fe robust

* K-12 capital
did_multiplegt_dyn log_r_pc_k12cap cty_number year r_pc_ART44524, ///
 controls(log_r_pc_all_oth_rev log_pop expobj_school_allother medinc) effects(3) /// 
 placebo(3) drop_if_d_miss_before_first_switch graph_off

estadd scalar p_placebo = e(p_jointplacebo)
est sto mob_k12cap
 
xtreg log_r_pc_k12cap c.r_pc_ART44524#i.post log_r_pc_all_oth_rev /// 
 log_pop expobj_school_allother medinc i.year if dcdh_sample==1, fe robust 

esttab mob_k12op mob_k12cap  using "onlineappendixB2.rtf", replace /// 
 b(%9.4f) se(%9.4f) s(p_placebo, label("Joint Sig. Placebo")) /// 
 order(Placebo_3 Placebo_2 Placebo_1 Effect_1 Effect_2 Effect_3 Av_tot_eff) ///
 coeflabels(Effect_1 "2017" Effect_2 "2018" Effect_3 "2019" ///
 Av_tot_eff "Avg Total Effect" /// 
 Placebo_1 "2015" Placebo_2 "2014" Placebo_3 "2013") ///
 nogaps compress
 
clear

